PIN_OPEN = 3;
PIN_GO = 2;
PIN_IS_OPEN = 1;--���õ�ƽ
PIN_LED1_TONER = 5;
PIN_LED2_DRUM = 6;
PIN_LED3_PAPER = 7;
PIN_LED4_READY = "A0";-- ADC����
gpio.mode(PIN_IS_OPEN,gpio.INT);

gpio.write(PIN_LED1_TONER,gpio.LOW);
gpio.write(PIN_LED2_DRUM,gpio.LOW);
gpio.write(PIN_LED3_PAPER,gpio.LOW);

gpio.mode(PIN_LED1_TONER,gpio.INPUT);
gpio.mode(PIN_LED2_DRUM,gpio.INPUT);
gpio.mode(PIN_LED3_PAPER,gpio.INPUT);

gpio.mode(PIN_OPEN,gpio.OUTPUT);
gpio.mode(PIN_GO,gpio.OUTPUT);
gpio.write(PIN_OPEN,gpio.HIGH);
gpio.write(PIN_GO,gpio.HIGH);
--��ʼ��ADC
adc.force_init_mode(adc.INIT_ADC);

wifi.eventmon.register(wifi.eventmon.STA_CONNECTED,function(t)
end)
wifi.eventmon.register(wifi.eventmon.STA_GOT_IP,function(t)
    --ws_init()
    dofile("printer.lua")
end)
dofile("time.lua")
dofile("wifi.lua")
if file.exists("config.lua") then
    dofile("config.lua")
end
if file.exists("user.lua") then
    dofile("user.lua")
end
function init()
    local SSID,PWD = wifi.sta.getconfig()
    print(SSID)
    if string.len(SSID) > 0 then
        wifi_connect(SSID,PWD)
        print("Configed",SSID)
    else
        print("Start Smart Config")
        wifi.sta.clearconfig()
        --wifi_start_smart()
    end

end

init()
